package permissions

import "yundian/internel/pkg/dingo"

type PermissionsAttr func(model *PermissionsModel)

type PermissionsAttrs []PermissionsAttr

// 执行设置属性值的函数
func (attrFunc PermissionsAttrs) Apply(model *PermissionsModel) {
	for _,f := range attrFunc {
		f(model)
	}
}

func WithID(id int) PermissionsAttr {
	return func(model *PermissionsModel) { model.Id = id }
}

func WithLabel(label string) PermissionsAttr {
	return func(model *PermissionsModel) { model.Label = label }
}

func WithName(name string) PermissionsAttr {
	return func(model *PermissionsModel) { model.Name = name }
}

func WithDescribe(describe string) PermissionsAttr {
	return func(model *PermissionsModel) { model.Describe = describe }
}

func WithStatus(status uint8) PermissionsAttr {
	return func(model *PermissionsModel) { model.Status = status }
}

func WithCreateAt(createAt dingo.Time) PermissionsAttr {
	return func(model *PermissionsModel) { model.CreateAt = createAt }
}

func WithUpdateAt(updateAt dingo.Time) PermissionsAttr {
	return func(model *PermissionsModel) { model.UpdateAt = updateAt }
}
